package sapling.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created by Administrator on 2017/6/2.
 */
@Entity
@Getter
@Setter
public class LandMass {

    public static final int TYPE_LANDMASS_OCCUPATION =1;//已种植
    public static final int TYPE_LANDMASS_LEISURE =0;//空闲地块

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id")
    private Long landMass_id;
    private double proportion;//地块面积
    private double length;//长度
    private double breadth;//宽度
    private double xgap=0;//横向间距
    private double ygap=0;//纵向间距
    private String serialNumber;//编号
    private Long Xcoordinate;//x坐标点
    private Long Ycoordinate;//y坐标点
    private int leftmargin;
    private int rightmargin;
    private String treeSpecies;//树种，多个用；号分隔
    private int amount;//总共可种植数量
    private int plant;//已种植数量
    private int generate;//是否已生成树坑，0未生成，1,已生成
    private int shape=1;//1井，2品字形
    private int shapetype=0;//0.默认为矩形 1.为梯形
    private int lefttopx=0;//各个点的坐标
    private int lefttopy=0;
    private int righttopx=0;
    private int righttopy=0;
    private int leftdownx=0;
    private int leftdowny=0;
    private int rightdownx=0;
    private int rightdowny=0;
    private int rows=0;//多少行
    private int columns=0;//多少列
    private String remarks;
    @ManyToOne
    @JoinColumn(name = "areaLocation_id", referencedColumnName = "id")
    @JsonIgnore
    private AreaLocation areaLocation;//所属区域

    @OneToMany(mappedBy = "landMass",cascade = CascadeType.ALL)
    @JsonIgnore
    private List<TreeWell> treeWells = new ArrayList<>();//一个地块多个树坑
    @Temporal(TemporalType.TIMESTAMP)
    @UpdateTimestamp
    @JsonIgnore
    private Date updateTime;
}
